package zdream.control.region;

/**
 * 主角的出生点
 * 
 * @author Zdream
 * @since 0.0.1
 * @date 2022-06-10
 */
public class SavePoint extends InterestPoint {
	public static final String TYPE_SPAWN = "spawn";
	public static final String TYPE_RELAY = "relay";

	public final boolean startPoint;
	public final boolean orientation;

	private SavePoint(float x, float y, String name, boolean startPoint, boolean orientation) {
		super(name, x, y);
		this.startPoint = startPoint;
		this.orientation = orientation;
	}

	public static SavePoint ofStartPoint(float xInRegion, float yInRegion) {
		return new SavePoint(xInRegion, yInRegion, TYPE_SPAWN, true, true);
	}

	public static SavePoint ofStartPoint(float xInRegion, float yInRegion, boolean orientation) {
		return new SavePoint(xInRegion, yInRegion, TYPE_SPAWN, true, orientation);
	}

	public static SavePoint ofSavePoint(float xInRegion, float yInRegion, String name) {
		return new SavePoint(xInRegion, yInRegion, name, false, true);
	}

	public static SavePoint ofSavePoint(float xInRegion, float yInRegion, String name, boolean orientation) {
		return new SavePoint(xInRegion, yInRegion, name, false, orientation);
	}

	@Override
	public boolean isForSave() {
		return true;
	}

	@Override
	public SavePoint asSave() {
		return this;
	}
}
